import { request } from '@/service/request';

/**
 * 轮播图服务
 */
export class SwiperService {
    /**
     * 获取轮播图列表
     */
    static async getSwiperList() {
        try {
            const response = await request.get<any>('/nurse_swiper/nurseSwiper/list', {}, {
                useErrMsg: true
            });
            
            if (response.error) {
                // console.error('获取轮播图列表失败:', response.error);
                return { error: response.error, success: null };
            }
            
            return { error: null, success: response.success };
        } catch (error) {
            // console.error('获取轮播图列表失败:', error);
            return { error, success: null };
        }
    }
}

/**
 * 轮播图 Hook
 */
export function useNurseSwiper() {
    const list = async () => {
        return await SwiperService.getSwiperList();
    };

    return {
        list
    };
}
